package presenters.component

import net.java.textilej.parser.MarkupParser
import net.java.textilej.parser.markup.textile.TextileDialect

class MarkupComponent {                                         

    def static namespace = "gp"

    def renderHtml = { markup ->
        MarkupParser parser = new MarkupParser(new TextileDialect())
        return parser.parseToHtml(markup)
    }

    def renderText = { text ->
        def paragraphs = text.split("\n")
        paragraphs.each {
            if(it.size() > 0) {
                builder.p(it)
            }
        }
    }
}